
package ch.hearc.java.jmapviewer.example;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JPanel;

import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;

/***
 * Marker
 * @author Adrian Moll
 *
 */
public class JPanelMapMarker extends JPanel implements MapMarker
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/
	public JPanelMapMarker(double latitude, double longitude)
		{
		this.latitude = latitude;
		this.longitude = longitude;
		geometry();
		control();
		apparence();
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/
	@Override
	public void paint(Graphics g, Point point)
		{
		this.setLocation(point);
		this.repaint();

		}

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	@Override
	public double getLat()
		{
		return latitude;
		}

	@Override
	public double getLon()
		{
		return longitude;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private void geometry()
		{
		this.setLayout(null);
		this.setSize(WIDTH, HEIGHT);
		checkBox = new JCheckBox("Checkbox");
		checkBox.setLocation(0, 0);
		checkBox.setSize(new Dimension(WIDTH, HEIGHT));
		checkBox.setBorder(BorderFactory.createEmptyBorder());

		this.add(checkBox, BorderLayout.CENTER);

		}

	private void control()
		{
		//Rien
		}

	private void apparence()
		{
		checkBox.setOpaque(false);
		checkBox.setForeground(Color.WHITE);
		this.setBackground(Color.DARK_GRAY);
		}

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	//Input
	private double latitude;
	private double longitude;

	//Tools
	private JCheckBox checkBox;

	private static final int WIDTH = 100;
	private static final int HEIGHT = 30;
	}
